import 'package:flutter/material.dart';

/// 2022年更新  适配 flutter 3.0
class InputChipHome extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return InputChipHomeState();
  }
}

class InputChipHomeState extends State {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("InputChip")),
      body: Center(
        child: buildInputChip(),
      ),
    );
  }

  buildInputChip() {
    return InputChip(
      label: const Text("测试"),
      labelStyle: const TextStyle(color: Colors.white),
      onPressed: () {
        print("pressed --");
      },

      deleteIconColor: Colors.white,
      onDeleted: () {
        print("ondeleted --");
      },
      padding: EdgeInsets.only(left: 4, right: 4),
      //按下的阴影
      pressElevation: 10,
      elevation: 2,
      isEnabled: true,
      //按钮不可用时的背景  isEnabled: false
      disabledColor: Colors.grey[200],
      //按钮可用时的背景 isEnabled: true,
      backgroundColor: Colors.blue,
    );
  }
}
